package com.iwhalecloud.citybrain.flow.platform.manager.application.service.impl.task;

import com.iwhalecloud.citybrain.flow.platform.manager.application.service.CustomEventHandler;
import org.flowable.engine.common.api.delegate.event.FlowableEngineEventType;
import org.flowable.engine.common.api.delegate.event.FlowableEvent;
import org.flowable.engine.common.api.delegate.event.FlowableEventType;
import org.flowable.engine.common.impl.event.FlowableEntityEventImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Handler - 任务创建后通知第三方平台
 *
 * @author lilh
 * @date 2019-01-28 16:44
 */
//@Component
public class CallbackThirdPlatformAfterTaskCreatedHandler implements CustomEventHandler {

    private Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public FlowableEventType getEventType() {
        return FlowableEngineEventType.TASK_CREATED;
    }

    @Override
    //@Async
    public void handle(FlowableEvent event) {
        //奇葩，任务创建时的event是org.flowable.engine.common.impl.event.FlowableEntityEventImpl
        //任务完成时的event是org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl
        if (!FlowableEntityEventImpl.class.isAssignableFrom(event.getClass())) {
            return;
        }
        FlowableEntityEventImpl entityEvent = (FlowableEntityEventImpl) event;


    }


}
